package com.aliyun.auikits.aicall.base;

import android.os.Parcel;
import android.os.Parcelable;

import java.util.ArrayList;

public class SessionHistory implements Parcelable {
    private final String sessionId;
    private final String userId;
    private final String agentId;
    private final String lastMessage;
    private final String nickName;
    private final String aiDes;
    private final String aiImgType;
//    private final String aiKeywords;
    private final ArrayList<String> aiKeywords;

    public SessionHistory(String sessionId, String userId, String agentId,String lastMessage,String nickName,String aiDes,ArrayList<String> aiKeywords,String aiImgType) {
        this.sessionId = sessionId;
        this.userId = userId;
        this.agentId = agentId;
        this.lastMessage = lastMessage;
        this.nickName = nickName;
        this.aiDes = aiDes;
        this.aiKeywords = aiKeywords;
        this.aiImgType = aiImgType;
    }

    protected SessionHistory(Parcel in) {
        sessionId = in.readString();
        userId = in.readString();
        agentId = in.readString();
        lastMessage = in.readString();
        nickName = in.readString();
        aiDes = in.readString();
        aiKeywords = in.createStringArrayList();
        aiImgType = in.readString();
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(sessionId);
        dest.writeString(userId);
        dest.writeString(agentId);
        dest.writeString(lastMessage);
        dest.writeString(nickName);
        dest.writeString(aiDes);
        dest.writeStringList(aiKeywords);
        dest.writeString(aiImgType);
    }

    @Override
    public int describeContents() {
        return 0;
    }

    public static final Creator<SessionHistory> CREATOR = new Creator<SessionHistory>() {
        @Override
        public SessionHistory createFromParcel(Parcel in) {
            return new SessionHistory(in);
        }

        @Override
        public SessionHistory[] newArray(int size) {
            return new SessionHistory[size];
        }
    };

    // Getters
    public String getSessionId() { return sessionId; }
    public String getUserId() { return userId; }
    public String getAgentId() { return agentId; }
    public String getLastMessage() { return lastMessage; }
    public String getNickName() { return nickName; }
    public String getAiDes() { return aiDes; }
    public ArrayList<String> getAiKeywords() { return aiKeywords; }
    public String getAiImgType() { return aiImgType; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        SessionHistory that = (SessionHistory) o;
        return sessionId.equals(that.sessionId);
    }

    @Override
    public int hashCode() {
        return sessionId.hashCode();
    }
}